//
//  PlateListCell.swift
//  知乎日报
//
//  Created by Ann on 2017/10/13.
//  Copyright © 2017年 Ann. All rights reserved.
//

import UIKit

class PlateListCell: UITableViewCell {
  
    
    lazy var homeIcon:UIImageView = {
        let view = UIImageView()
        
        view.image = #imageLiteral(resourceName: "Menu_Icon_Home")
        view.sizeToFit()
        return view
    }()

    var object:String?{
        didSet{
             title.text = object
            iconView.image = UIImage(named: "Menu_Follow")
            if object == "首页" || object == "不许无聊"{
            
            iconView.image = UIImage(named: "Menu_Enter")
            }
          
        }
    }
    
   lazy var title:UILabel = {
    let lab = UILabel()
        lab.text = ""
    
        lab.font = UIFont.systemFont(ofSize: 16)
       lab.textColor = userViewLabelColor
    
    return lab
    }()
    
    lazy var iconView:UIImageView = {
    let view = UIImageView()
        view.image = UIImage(named: "Menu_Follow")
        
    return view
    }()
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        contentView.addSubview(title)
        contentView.addSubview(iconView)
        
        backgroundColor = userViewBackground
        
        setLayout()
        
        iconView.sizeToFit()
        title.sizeToFit()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
    
    }
    func setLayout(){
    
    title.snp.makeConstraints { (make) in
        make.left.equalTo(contentView.snp.left).offset(iconMargin)
        make.centerY.equalTo(contentView.snp.centerY)
        make.height.equalTo(contentView.snp.height)
        make.width.equalTo(200)
        
        }
    iconView.snp.makeConstraints { (make) in
        make.left.equalTo(title.snp.right)
        make.centerY.equalTo(title.snp.centerY)
        
        }
    
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
 
    }

}
